package com.central.common.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.central.common.entity.DataRelated;
import com.central.common.entity.TaskContent;
import com.central.common.entity.TaskParams;
import com.central.common.enums.TaskType;
import com.central.common.handler.ListDataRelToStringHandler;
import com.central.common.handler.ListStrToStringHandler;
import com.central.common.handler.TaskParamsToStringHandler;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

import static com.baomidou.mybatisplus.annotation.FieldStrategy.NOT_NULL;

/**
 * @author Tindy
 * @date 2021/6/24
 * @describe
 */
@Data
@EqualsAndHashCode(callSuper=true)
@TableName(value = "sch_task_definition",autoResultMap = true)
public class TaskDefinition extends SuperEntity {
    private Long taskDefinedId;
    private Long taskDefinedLogId;
    private String name;
    private String description;
    private TaskType taskType;
    private Long proId;
    private String proName;
    private int version;
    private String taskContent;
    @TableField(jdbcType = JdbcType.VARCHAR, insertStrategy = NOT_NULL, typeHandler = TaskParamsToStringHandler.class)
    private TaskParams taskParams;
    @TableField(jdbcType = JdbcType.VARCHAR, insertStrategy = NOT_NULL, typeHandler = ListDataRelToStringHandler.class)
    private List<DataRelated> dataRelateds;
    @TableField(jdbcType = JdbcType.VARCHAR,typeHandler = ListStrToStringHandler.class,insertStrategy =NOT_NULL)
    private List<String> owners;
    private Boolean isTmp;
    public TaskDefinition(){}
    public TaskDefinition(Long id){
        setId(id);
    }
}
